<!DOCTYPE html >
<html>
<head>
    <link rel="stylesheet" href="demos.css" type="text/css" media="screen" />
    
    <script src="../libraries/RGraph.common.core.js" ></script>
    <script src="../libraries/RGraph.common.dynamic.js" ></script>
    <script src="../libraries/RGraph.common.tooltips.js" ></script>
    <script src="../libraries/RGraph.common.key.js" ></script>
    <script src="../libraries/RGraph.pie.js" ></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <!--[if lt IE 9]><script src="../excanvas/excanvas.js"></script><![endif]-->

    <title>A Pie chart that retrieves JSON data via AJAX</title>
    
    <meta name="robots" content="noindex,nofollow" />
    <meta name="description" content="A Pie chart that retrieves JSON data via AJAX" />
     
</head>
<body>

    <h1>A Pie chart that retrieves JSON data via AJAX</h1>

    <div style="background-color: #ffc; border: 2px solid #cc0; border-radius: 5px; padding: 5px;">
        <b>Note:</b>
        For browser security reasons the AJAX demos don't work offline. You can view the demos on the RGraph website here:
        <a href="http://www.rgraph.net/demos/" target="_blank" rel="nofollow">http://www.rgraph.net/demos</a>
    </div>

    <canvas id="cvs" width="450" height="350">[No canvas support]</canvas>
    
    <script>
        function drawPie (json)
        {
            var pie = new RGraph.Pie({
                id: 'cvs',
                data: json.data,
                options: {
                    tooltips: json.labels,
                    key: {
                        self: json.labels,
                        position: {
                            graph: {
                                boxed: false
                            }
                        }
                    },  
                    centerx: 175                    
                }
            }).draw()
        }
        
        RGraph.AJAX.getJSON('/getdata.html?json', drawPie);
    </script>

    <p>        
        <a href="./">&laquo; Back</a>
    </p>

</body>
</html>